#include "StdAfx.h"
#include "StatusBarItem.h"
#include "StatusBar.h"

// CStatusBarItem

STDMETHODIMP CStatusBarItem::InterfaceSupportsErrorInfo(REFIID riid)
{
	static const IID* arr[] = 
	{
		&IID_IStatusBarItem
	};

	for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		if (InlineIsEqualGUID(*arr[i],riid))
			return S_OK;
	}
	return S_FALSE;
}


STDMETHODIMP CStatusBarItem::get_Caption(BSTR *pVal)
{
	CStatusBar *pStatusBar = CStatusBar::This();
	ATLASSERT(NULL != pStatusBar);

	pStatusBar->GetPaneText(m_pStatusBarItemInfo->nID, *pVal);

	return S_OK;
}


STDMETHODIMP CStatusBarItem::put_Caption(BSTR newVal)
{
	CStatusBar *pStatusBar = CStatusBar::This();
	ATLASSERT(NULL != pStatusBar);

	pStatusBar->SetPaneText(m_pStatusBarItemInfo->nID, newVal);

	return S_OK;
}


STDMETHODIMP CStatusBarItem::get_Enable(VARIANT_BOOL* pVal)
{
	CStatusBar *pStatusBar = CStatusBar::This();
	ATLASSERT(NULL != pStatusBar);

	return S_FALSE;
}


STDMETHODIMP CStatusBarItem::put_Enable(VARIANT_BOOL newVal)
{
	CStatusBar *pStatusBar = CStatusBar::This();
	ATLASSERT(NULL != pStatusBar);

	return S_FALSE;
}


STDMETHODIMP CStatusBarItem::get_Icon(HICON* pVal)
{
	CStatusBar *pStatusBar = CStatusBar::This();

	ATLASSERT(NULL != pStatusBar);
	pStatusBar->GetPaneIcon(m_pStatusBarItemInfo->nID, *pVal);

	return S_OK;
}


STDMETHODIMP CStatusBarItem::put_Icon(HICON newVal)
{
	CStatusBar *pStatusBar = CStatusBar::This();

	ATLASSERT(NULL != pStatusBar);
	pStatusBar->SetPaneIcon(m_pStatusBarItemInfo->nID, newVal);

	return S_OK;
}


STDMETHODIMP CStatusBarItem::get_Width(int* pVal)
{
	return S_FALSE;
}


STDMETHODIMP CStatusBarItem::put_Width(int newVal)
{
	return S_FALSE;
}

